<template>
  <div class="department">
    <pageSearch @query-click="handleQueryClick" @reset-click="handleResetClick"> </pageSearch>
    <pageContent
      ref="contentRef"
      @newBtnClick="handleNewBtnClick"
      @editBtnClick="handleeditBtnClick"
    ></pageContent>
    <pageModal ref="modalRef"></pageModal>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import pageSearch from './c-cpns/page-search.vue'
import pageContent from './c-cpns/page-content.vue'
import pageModal from './c-cpns/page-modal.vue'

// 点击搜索,content的操作
const contentRef = ref<InstanceType<typeof pageContent>>()
function handleQueryClick(queryInfo: any) {
  contentRef.value?.fetchPageListData(queryInfo)
}
function handleResetClick() {
  contentRef.value?.fetchPageListData()
}

const modalRef = ref<InstanceType<typeof pageModal>>()
function handleNewBtnClick() {
  modalRef.value?.setModelVisible()
}
function handleeditBtnClick(itemData: any) {
  modalRef.value?.setModelVisible(false, itemData)
}
</script>

<style scoped>
.department {
}
</style>
